package com.android.miniProject;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;


public class TrainingActivity extends Activity{
	
	/** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.training_layout);

        // Click Listener
        OnClickListener clickListener = new OnClickListener()
        {
          @Override
          public void onClick(View actualView)
          {
        	  switch(actualView.getId()){
        	    
    	  	// Boutons du menu
    	  	case R.id.button1 :       	  
    	  		// Navigation to runActivity
    	  		Intent runIntent = new Intent(actualView.getContext(), RunActivity.class);
    	  		startActivity(runIntent);
    	  		break;
    	  	case R.id.button2 : 
    	  		findViewById(R.id.button2).setEnabled(false);
    	  		break;
    	  	case R.id.button3:
    	  		Intent analyseIntent = new Intent(actualView.getContext(),AnalyseActivity.class);
    	  		startActivity(analyseIntent);
    	  		break;
    	  		
    	  	case R.id.button4 : 
    	  	// Navigation to ServicesDemo (MUSIC in background : see services)
    	  		Intent musicIntent = new Intent(actualView.getContext(),ServicesMusic.class);
    	  		startActivity(musicIntent);
    	  		break;
        	  	
        	  }
          }
       };
       
       Button newRun = (Button) findViewById(R.id.button1);
       newRun.setOnClickListener(clickListener);
       
       Button trainings = (Button) findViewById(R.id.button2);
       trainings.setOnClickListener(clickListener);
       
       Button post_run = (Button) findViewById(R.id.button3);
       post_run.setOnClickListener(clickListener);
       
       Button settings = (Button) findViewById(R.id.button4);
       settings.setOnClickListener(clickListener);
        
    }
}
